<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>qLibc: utilities/qstring.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">qLibc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('qstring_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">qstring.c File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>String APIs.  
<a href="#details">More...</a></p>

<p><a href="qstring_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a673d4ee449a08223e9f26508fa7d81a3"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a673d4ee449a08223e9f26508fa7d81a3">qstrtrim</a> (char *str)</td></tr>
<tr class="memdesc:a673d4ee449a08223e9f26508fa7d81a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove white spaces(including CR, LF) from head and tail of the string.  <br /></td></tr>
<tr class="separator:a673d4ee449a08223e9f26508fa7d81a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a70a69740b083dfe3116b2dd025aebdcc"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a70a69740b083dfe3116b2dd025aebdcc">qstrtrim_head</a> (char *str)</td></tr>
<tr class="memdesc:a70a69740b083dfe3116b2dd025aebdcc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove heading white spaces of the string.  <br /></td></tr>
<tr class="separator:a70a69740b083dfe3116b2dd025aebdcc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab20a0316dfb2bc4f48c69d54fcb21355"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#ab20a0316dfb2bc4f48c69d54fcb21355">qstrtrim_tail</a> (char *str)</td></tr>
<tr class="memdesc:ab20a0316dfb2bc4f48c69d54fcb21355"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove tailing white spaces(including CR, LF) of the string.  <br /></td></tr>
<tr class="separator:ab20a0316dfb2bc4f48c69d54fcb21355"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82ebc5e528abf5257099994578904b51"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a82ebc5e528abf5257099994578904b51">qstrunchar</a> (char *str, char <a class="el" href="qhttpclient_8c.html#ac3c34055be115314ffe7f18c3d19eb54">head</a>, char tail)</td></tr>
<tr class="memdesc:a82ebc5e528abf5257099994578904b51"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove character from head and tail of the string.  <br /></td></tr>
<tr class="separator:a82ebc5e528abf5257099994578904b51"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac4aec98006a9b0f9eb54c8c43121425e"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#ac4aec98006a9b0f9eb54c8c43121425e">qstrreplace</a> (const char *mode, char *srcstr, const char *tokstr, const char *word)</td></tr>
<tr class="memdesc:ac4aec98006a9b0f9eb54c8c43121425e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Replace string or tokens as word from source string with given mode.  <br /></td></tr>
<tr class="separator:ac4aec98006a9b0f9eb54c8c43121425e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24dcde4b707ed664b3962e1bf400de0f"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a24dcde4b707ed664b3962e1bf400de0f">qstrcpy</a> (char *dst, size_t size, const char *src)</td></tr>
<tr class="memdesc:a24dcde4b707ed664b3962e1bf400de0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy src string to dst.  <br /></td></tr>
<tr class="separator:a24dcde4b707ed664b3962e1bf400de0f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3be760da8b51532dad32d483bdbcf7b5"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a3be760da8b51532dad32d483bdbcf7b5">qstrncpy</a> (char *dst, size_t size, const char *src, size_t nbytes)</td></tr>
<tr class="memdesc:a3be760da8b51532dad32d483bdbcf7b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy src string to dst no more than n bytes.  <br /></td></tr>
<tr class="separator:a3be760da8b51532dad32d483bdbcf7b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90c6f8a88cb9de91d5e74fbd055d4551"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a90c6f8a88cb9de91d5e74fbd055d4551">qstrdupf</a> (const char *format,...)</td></tr>
<tr class="memdesc:a90c6f8a88cb9de91d5e74fbd055d4551"><td class="mdescLeft">&#160;</td><td class="mdescRight">Duplicate a formatted string.  <br /></td></tr>
<tr class="separator:a90c6f8a88cb9de91d5e74fbd055d4551"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86f97f3fb3a432af6fa1dd55cdc100bc"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a86f97f3fb3a432af6fa1dd55cdc100bc">qstrdup_between</a> (const char *str, const char *start, const char *end)</td></tr>
<tr class="memdesc:a86f97f3fb3a432af6fa1dd55cdc100bc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Duplicate a substing set.  <br /></td></tr>
<tr class="separator:a86f97f3fb3a432af6fa1dd55cdc100bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa27b0a87aa68e3ee318e3280a5f9d9d5"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#aa27b0a87aa68e3ee318e3280a5f9d9d5">qmemdup</a> (const void *data, size_t size)</td></tr>
<tr class="memdesc:aa27b0a87aa68e3ee318e3280a5f9d9d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Duplicate a copy of memory data.  <br /></td></tr>
<tr class="separator:aa27b0a87aa68e3ee318e3280a5f9d9d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a728b578553bfb9fe6b88af5a26a95e2d"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a728b578553bfb9fe6b88af5a26a95e2d">qstrcatf</a> (char *str, const char *format,...)</td></tr>
<tr class="memdesc:a728b578553bfb9fe6b88af5a26a95e2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Append formatted string to the end of the source str.  <br /></td></tr>
<tr class="separator:a728b578553bfb9fe6b88af5a26a95e2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd9722d596de17775ff99107d124404c"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#abd9722d596de17775ff99107d124404c">qstrgets</a> (char *buf, size_t size, char **offset)</td></tr>
<tr class="memdesc:abd9722d596de17775ff99107d124404c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get one line from the string offset.  <br /></td></tr>
<tr class="separator:abd9722d596de17775ff99107d124404c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a019f74d6452ba69f93c1905a2c5363b2"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a019f74d6452ba69f93c1905a2c5363b2">qstrrev</a> (char *str)</td></tr>
<tr class="memdesc:a019f74d6452ba69f93c1905a2c5363b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reverse the order of characters in the string.  <br /></td></tr>
<tr class="separator:a019f74d6452ba69f93c1905a2c5363b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc14c95a2ddadcd8d983d6e12d372d12"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#acc14c95a2ddadcd8d983d6e12d372d12">qstrupper</a> (char *str)</td></tr>
<tr class="memdesc:acc14c95a2ddadcd8d983d6e12d372d12"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert character to bigger character.  <br /></td></tr>
<tr class="separator:acc14c95a2ddadcd8d983d6e12d372d12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad42f6086a25ed4be54f2a18a8973dbd8"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#ad42f6086a25ed4be54f2a18a8973dbd8">qstrlower</a> (char *str)</td></tr>
<tr class="memdesc:ad42f6086a25ed4be54f2a18a8973dbd8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert character to lower character.  <br /></td></tr>
<tr class="separator:ad42f6086a25ed4be54f2a18a8973dbd8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a052c99b86a780692b68ba6cda90b477d"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a052c99b86a780692b68ba6cda90b477d">qstrtok</a> (char *str, const char *delimiters, char *retstop, int *offset)</td></tr>
<tr class="memdesc:a052c99b86a780692b68ba6cda90b477d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Split string into tokens.  <br /></td></tr>
<tr class="separator:a052c99b86a780692b68ba6cda90b477d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a38e5f0c9670254df2a1e4246e13d0c54"><td class="memItemLeft" align="right" valign="top">qlist_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a38e5f0c9670254df2a1e4246e13d0c54">qstrtokenizer</a> (const char *str, const char *delimiters)</td></tr>
<tr class="memdesc:a38e5f0c9670254df2a1e4246e13d0c54"><td class="mdescLeft">&#160;</td><td class="mdescRight">String Tokenizer.  <br /></td></tr>
<tr class="separator:a38e5f0c9670254df2a1e4246e13d0c54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2e9c44c24a06d24bccc1967972c63909"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a2e9c44c24a06d24bccc1967972c63909">qstrunique</a> (const char *seed)</td></tr>
<tr class="memdesc:a2e9c44c24a06d24bccc1967972c63909"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generate unique id.  <br /></td></tr>
<tr class="separator:a2e9c44c24a06d24bccc1967972c63909"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5c7f3c367f90928d56b2db1cd60f646"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#ae5c7f3c367f90928d56b2db1cd60f646">qstr_comma_number</a> (int number)</td></tr>
<tr class="memdesc:ae5c7f3c367f90928d56b2db1cd60f646"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert integer to comma string.  <br /></td></tr>
<tr class="separator:ae5c7f3c367f90928d56b2db1cd60f646"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6ddf2449ee1edb1139005fa88213567c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a6ddf2449ee1edb1139005fa88213567c">qstrtest</a> (int(*testfunc)(int), const char *str)</td></tr>
<tr class="memdesc:a6ddf2449ee1edb1139005fa88213567c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test for an alpha-numeric string.  <br /></td></tr>
<tr class="separator:a6ddf2449ee1edb1139005fa88213567c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8e066e1239a1670b9640bdf0e456b89"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#af8e066e1239a1670b9640bdf0e456b89">qstr_is_email</a> (const char *email)</td></tr>
<tr class="memdesc:af8e066e1239a1670b9640bdf0e456b89"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test for an email-address formatted string.  <br /></td></tr>
<tr class="separator:af8e066e1239a1670b9640bdf0e456b89"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a87849863c09feb068f316ffb63aaef03"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#a87849863c09feb068f316ffb63aaef03">qstr_is_ip4addr</a> (const char *str)</td></tr>
<tr class="memdesc:a87849863c09feb068f316ffb63aaef03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test for an IPv4 address string.  <br /></td></tr>
<tr class="separator:a87849863c09feb068f316ffb63aaef03"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5ce5ba220fb8ad35c4434d54912f00b"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qstring_8c.html#ae5ce5ba220fb8ad35c4434d54912f00b">qstr_conv_encoding</a> (const char *str, const char *fromcode, const char *tocode, float mag)</td></tr>
<tr class="memdesc:ae5ce5ba220fb8ad35c4434d54912f00b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert character encoding.  <br /></td></tr>
<tr class="separator:ae5ce5ba220fb8ad35c4434d54912f00b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>String APIs. </p>

<p class="definition">Definition in file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a673d4ee449a08223e9f26508fa7d81a3" name="a673d4ee449a08223e9f26508fa7d81a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a673d4ee449a08223e9f26508fa7d81a3">&#9670;&#160;</a></span>qstrtrim()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrtrim </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Remove white spaces(including CR, LF) from head and tail of the string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of source string if successful, otherwise returns NULL</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify source string directly. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00055">55</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a70a69740b083dfe3116b2dd025aebdcc" name="a70a69740b083dfe3116b2dd025aebdcc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a70a69740b083dfe3116b2dd025aebdcc">&#9670;&#160;</a></span>qstrtrim_head()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrtrim_head </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Remove heading white spaces of the string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of source string if successful, otherwise returns NULL</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify source string directly. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00090">90</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="ab20a0316dfb2bc4f48c69d54fcb21355" name="ab20a0316dfb2bc4f48c69d54fcb21355"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab20a0316dfb2bc4f48c69d54fcb21355">&#9670;&#160;</a></span>qstrtrim_tail()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrtrim_tail </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Remove tailing white spaces(including CR, LF) of the string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of source string if successful, otherwise returns NULL</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify source string directly. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00116">116</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a82ebc5e528abf5257099994578904b51" name="a82ebc5e528abf5257099994578904b51"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82ebc5e528abf5257099994578904b51">&#9670;&#160;</a></span>qstrunchar()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrunchar </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>head</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>tail</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Remove character from head and tail of the string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>source string </td></tr>
    <tr><td class="paramname">head</td><td>heading character </td></tr>
    <tr><td class="paramname">tail</td><td>tailing character</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of source string if successful, otherwise returns NULL</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify source string directly.</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *str = strdup(<span class="stringliteral">&quot;   \&quot;hello world\&quot;   &quot;</span>);</div>
<div class="line"><a class="code hl_function" href="qstring_8c.html#a673d4ee449a08223e9f26508fa7d81a3">qstrtrim</a>(str); <span class="comment">// to remove white spaces</span></div>
<div class="line"><a class="code hl_function" href="qstring_8c.html#a82ebc5e528abf5257099994578904b51">qstrunchar</a>(str, <span class="charliteral">&#39;&quot;&#39;</span>, <span class="charliteral">&#39;&quot;&#39;</span>); <span class="comment">// to unquote</span></div>
<div class="ttc" id="aqstring_8c_html_a673d4ee449a08223e9f26508fa7d81a3"><div class="ttname"><a href="qstring_8c.html#a673d4ee449a08223e9f26508fa7d81a3">qstrtrim</a></div><div class="ttdeci">char * qstrtrim(char *str)</div><div class="ttdoc">Remove white spaces(including CR, LF) from head and tail of the string.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00055">qstring.c:55</a></div></div>
<div class="ttc" id="aqstring_8c_html_a82ebc5e528abf5257099994578904b51"><div class="ttname"><a href="qstring_8c.html#a82ebc5e528abf5257099994578904b51">qstrunchar</a></div><div class="ttdeci">char * qstrunchar(char *str, char head, char tail)</div><div class="ttdoc">Remove character from head and tail of the string.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00149">qstring.c:149</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00149">149</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="ac4aec98006a9b0f9eb54c8c43121425e" name="ac4aec98006a9b0f9eb54c8c43121425e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac4aec98006a9b0f9eb54c8c43121425e">&#9670;&#160;</a></span>qstrreplace()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrreplace </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>srcstr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>tokstr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>word</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Replace string or tokens as word from source string with given mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>replacing mode </td></tr>
    <tr><td class="paramname">srcstr</td><td>source string </td></tr>
    <tr><td class="paramname">tokstr</td><td>token or string </td></tr>
    <tr><td class="paramname">word</td><td>target word to be replaced</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced or source string depending on the mode if successful, otherwise returns NULL</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The mode argument has two separated characters. First character is used to decide replacing method and can be 't' or 's'. The character 't' and 's' stand on [t]oken and [s]tring.</dd></dl>
<p>When 't' is given each character of the token string(third argument) will be compared with source string individually. If matched one is found. the character will be replaced with given work.</p>
<p>If 's' is given instead of 't'. Token string will be analyzed only one chunk word. So the replacement will be occured when the case of whole word matched.</p>
<p>Second character is used to decide returning memory type and can be 'n' or 'r' which are stand on [n]ew and [r]eplace.</p>
<p>When 'n' is given the result will be placed into new array so you should free the return string after using. Instead of this, you can also use 'r' character to modify source string directly. In this case, given source string should have enough space. Be sure that untouchable value can not be used for source string.</p>
<p>So there are four associatable modes such like below.</p>
<p>Mode "tn" : [t]oken replacing &amp; putting the result into [n]ew array. Mode "tr" : [t]oken replacing &amp; [r]eplace source string directly. Mode "sn" : [s]tring replacing &amp; putting the result into [n]ew array. Mode "sr" : [s]tring replacing &amp; [r]eplace source string directly.</p>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> srcstr[256], *retstr;</div>
<div class="line"><span class="keywordtype">char</span> mode[4][2+1] = {<span class="stringliteral">&quot;tn&quot;</span>, <span class="stringliteral">&quot;tr&quot;</span>, <span class="stringliteral">&quot;sn&quot;</span>, <span class="stringliteral">&quot;sr&quot;</span>};</div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">for</span>(i = 0; i &lt; 4; i++) {</div>
<div class="line">  strcpy(srcstr, <span class="stringliteral">&quot;Welcome to The qDecoder Project.&quot;</span>);</div>
<div class="line"> </div>
<div class="line">  printf(<span class="stringliteral">&quot;before %s : srcstr = %s\n&quot;</span>, mode[i], srcstr);</div>
<div class="line">  retstr = <a class="code hl_function" href="qstring_8c.html#ac4aec98006a9b0f9eb54c8c43121425e">qstrreplace</a>(mode[i], srcstr, <span class="stringliteral">&quot;The&quot;</span>, <span class="stringliteral">&quot;_&quot;</span>);</div>
<div class="line">  printf(<span class="stringliteral">&quot;after  %s : srcstr = %s\n&quot;</span>, mode[i], srcstr);</div>
<div class="line">  printf(<span class="stringliteral">&quot;            retstr = %s\n\n&quot;</span>, retstr);</div>
<div class="line">  <span class="keywordflow">if</span>(mode[i][1] == <span class="charliteral">&#39;n&#39;</span>) free(retstr);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">--[Result]--</div>
<div class="line">before tn : srcstr = Welcome to The qDecoder Project.</div>
<div class="line">after  tn : srcstr = Welcome to The qDecoder Project.</div>
<div class="line">            retstr = W_lcom_ _o ___ qD_cod_r Proj_c_.</div>
<div class="line"> </div>
<div class="line">before tr : srcstr = Welcome to The qDecoder Project.</div>
<div class="line">after  tr : srcstr = W_lcom_ _o ___ qD_cod_r Proj_c_.</div>
<div class="line">            retstr = W_lcom_ _o ___ qD_cod_r Proj_c_.</div>
<div class="line"> </div>
<div class="line">before sn : srcstr = Welcome to The qDecoder Project.</div>
<div class="line">after  sn : srcstr = Welcome to The qDecoder Project.</div>
<div class="line">            retstr = Welcome to _ qDecoder Project.</div>
<div class="line"> </div>
<div class="line">before sr : srcstr = Welcome to The qDecoder Project.</div>
<div class="line">after  sr : srcstr = Welcome to _ qDecoder Project.</div>
<div class="line">            retstr = Welcome to _ qDecoder Project.</div>
<div class="ttc" id="aqstring_8c_html_ac4aec98006a9b0f9eb54c8c43121425e"><div class="ttname"><a href="qstring_8c.html#ac4aec98006a9b0f9eb54c8c43121425e">qstrreplace</a></div><div class="ttdeci">char * qstrreplace(const char *mode, char *srcstr, const char *tokstr, const char *word)</div><div class="ttdoc">Replace string or tokens as word from source string with given mode.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00236">qstring.c:236</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00236">236</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a24dcde4b707ed664b3962e1bf400de0f" name="a24dcde4b707ed664b3962e1bf400de0f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a24dcde4b707ed664b3962e1bf400de0f">&#9670;&#160;</a></span>qstrcpy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrcpy </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>src</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Copy src string to dst. </p>
<p>The dst string array will be always terminated by NULL character. Also allows overlap between src and dst.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dst</td><td>a pointer of the string to be copied </td></tr>
    <tr><td class="paramname">size</td><td>the size of dst character arrary </td></tr>
    <tr><td class="paramname">src</td><td>a pointer of source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>always returns a pointer of dst </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00325">325</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a3be760da8b51532dad32d483bdbcf7b5" name="a3be760da8b51532dad32d483bdbcf7b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3be760da8b51532dad32d483bdbcf7b5">&#9670;&#160;</a></span>qstrncpy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrncpy </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nbytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Copy src string to dst no more than n bytes. </p>
<p>The dst string array will be always terminated by NULL character. Also allows overlap between src and dst.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dst</td><td>a pointer of the string to be copied </td></tr>
    <tr><td class="paramname">size</td><td>the size of dst character arrary </td></tr>
    <tr><td class="paramname">src</td><td>a pointer of source string </td></tr>
    <tr><td class="paramname">nbytes</td><td>number of bytes to copy</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>always returns a pointer of dst </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00344">344</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a90c6f8a88cb9de91d5e74fbd055d4551" name="a90c6f8a88cb9de91d5e74fbd055d4551"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a90c6f8a88cb9de91d5e74fbd055d4551">&#9670;&#160;</a></span>qstrdupf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrdupf </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Duplicate a formatted string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">format</td><td>string format</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced string if successful, otherwise returns NULL </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00363">363</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a86f97f3fb3a432af6fa1dd55cdc100bc" name="a86f97f3fb3a432af6fa1dd55cdc100bc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a86f97f3fb3a432af6fa1dd55cdc100bc">&#9670;&#160;</a></span>qstrdup_between()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrdup_between </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>start</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>end</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Duplicate a substing set. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a pointer of original string </td></tr>
    <tr><td class="paramname">start</td><td>substring which is started with this </td></tr>
    <tr><td class="paramname">end</td><td>substring which is ended with this</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced string if successful, otherwise returns NULL </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00384">384</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="aa27b0a87aa68e3ee318e3280a5f9d9d5" name="aa27b0a87aa68e3ee318e3280a5f9d9d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa27b0a87aa68e3ee318e3280a5f9d9d5">&#9670;&#160;</a></span>qmemdup()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void * qmemdup </td>
          <td>(</td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Duplicate a copy of memory data. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>source data </td></tr>
    <tr><td class="paramname">size</td><td>data size</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced data which's content is identical to source data. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00413">413</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a728b578553bfb9fe6b88af5a26a95e2d" name="a728b578553bfb9fe6b88af5a26a95e2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a728b578553bfb9fe6b88af5a26a95e2d">&#9670;&#160;</a></span>qstrcatf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrcatf </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Append formatted string to the end of the source str. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a pointer of original string </td></tr>
    <tr><td class="paramname">format</td><td>string format to append</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of str if successful, otherwise returns NULL </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00435">435</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="abd9722d596de17775ff99107d124404c" name="abd9722d596de17775ff99107d124404c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abd9722d596de17775ff99107d124404c">&#9670;&#160;</a></span>qstrgets()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrgets </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get one line from the string offset. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>buffer pointer </td></tr>
    <tr><td class="paramname">size</td><td>buffer size </td></tr>
    <tr><td class="paramname">offset</td><td>a offset pointer which point source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of buffer if successful, otherwise(EOF) returns NULL</dd></dl>
<dl class="section note"><dt>Note</dt><dd>CR and LF will not be stored.</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *text=<span class="stringliteral">&quot;Hello\nWorld&quot;</span>;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">char</span> *offset = text;</div>
<div class="line"><span class="keywordtype">char</span> buf[1024];</div>
<div class="line"><span class="keywordflow">while</span>(<a class="code hl_function" href="qstring_8c.html#abd9722d596de17775ff99107d124404c">qstrgets</a>(buf, <span class="keyword">sizeof</span>(buf), &amp;offset) == NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;%s\n&quot;</span>, buf);</div>
<div class="line">}</div>
<div class="ttc" id="aqstring_8c_html_abd9722d596de17775ff99107d124404c"><div class="ttname"><a href="qstring_8c.html#abd9722d596de17775ff99107d124404c">qstrgets</a></div><div class="ttdeci">char * qstrgets(char *buf, size_t size, char **offset)</div><div class="ttdoc">Get one line from the string offset.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00468">qstring.c:468</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00468">468</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a019f74d6452ba69f93c1905a2c5363b2" name="a019f74d6452ba69f93c1905a2c5363b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a019f74d6452ba69f93c1905a2c5363b2">&#9670;&#160;</a></span>qstrrev()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrrev </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reverse the order of characters in the string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a pointer of source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>always returns a pointer of str</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify str directly. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00500">500</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="acc14c95a2ddadcd8d983d6e12d372d12" name="acc14c95a2ddadcd8d983d6e12d372d12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acc14c95a2ddadcd8d983d6e12d372d12">&#9670;&#160;</a></span>qstrupper()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrupper </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert character to bigger character. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a pointer of source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>always returns a pointer of str</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify str directly. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00523">523</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="ad42f6086a25ed4be54f2a18a8973dbd8" name="ad42f6086a25ed4be54f2a18a8973dbd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad42f6086a25ed4be54f2a18a8973dbd8">&#9670;&#160;</a></span>qstrlower()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrlower </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert character to lower character. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>a pointer of source string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>always returns a pointer of str</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This modify str directly. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00543">543</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a052c99b86a780692b68ba6cda90b477d" name="a052c99b86a780692b68ba6cda90b477d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a052c99b86a780692b68ba6cda90b477d">&#9670;&#160;</a></span>qstrtok()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrtok </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>delimiters</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>retstop</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Split string into tokens. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>source string </td></tr>
    <tr><td class="paramname">delimiters</td><td>string that specifies a set of delimiters that may surround the token being extracted </td></tr>
    <tr><td class="paramname">retstop</td><td>stop delimiter character will be stored. it can be NULL if you don't want to know. </td></tr>
    <tr><td class="paramname">offset</td><td>integer pointer used for store last position. (must be reset to 0)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the first byte of a token if successful, otherwise returns NULL.</dd></dl>
<div class="fragment"><div class="line"> <span class="keywordtype">char</span> *str = strdup(<span class="stringliteral">&quot;Hello,world|Thank,you&quot;</span>);</div>
<div class="line"> <span class="keywordtype">char</span> *token;</div>
<div class="line"> <span class="keywordtype">int</span> offset = 0;</div>
<div class="line"> <span class="keywordflow">while</span>((token = <a class="code hl_function" href="qstring_8c.html#a052c99b86a780692b68ba6cda90b477d">qstrtok</a>(str, <span class="stringliteral">&quot;|,&quot;</span>, NULL, &amp;offset)) != NULL) {</div>
<div class="line">   printf(<span class="stringliteral">&quot;%s\n&quot;</span>, token);</div>
<div class="line">}</div>
<div class="ttc" id="aqstring_8c_html_a052c99b86a780692b68ba6cda90b477d"><div class="ttname"><a href="qstring_8c.html#a052c99b86a780692b68ba6cda90b477d">qstrtok</a></div><div class="ttdeci">char * qstrtok(char *str, const char *delimiters, char *retstop, int *offset)</div><div class="ttdoc">Split string into tokens.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00583">qstring.c:583</a></div></div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>This may modify str argument. The major difference between <a class="el" href="qstring_8c.html#a052c99b86a780692b68ba6cda90b477d" title="Split string into tokens.">qstrtok()</a> and standard strtok() is that <a class="el" href="qstring_8c.html#a052c99b86a780692b68ba6cda90b477d" title="Split string into tokens.">qstrtok()</a> can returns empty string tokens. If the str is "a:b::d", <a class="el" href="qstring_8c.html#a052c99b86a780692b68ba6cda90b477d" title="Split string into tokens.">qstrtok()</a> returns "a", "b", "", "d". But strtok() returns "a","b","d". </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00583">583</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a38e5f0c9670254df2a1e4246e13d0c54" name="a38e5f0c9670254df2a1e4246e13d0c54"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a38e5f0c9670254df2a1e4246e13d0c54">&#9670;&#160;</a></span>qstrtokenizer()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">qlist_t * qstrtokenizer </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>delimiters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>String Tokenizer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>source string </td></tr>
    <tr><td class="paramname">delimiters</td><td>string that specifies a set of delimiters that may surround the token being extracted</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>qlist container pointer otherwise returns NULL.</dd></dl>
<div class="fragment"><div class="line">qlist_t *tokens = qstr_tokenizer(<span class="stringliteral">&quot;a:b:c&quot;</span>, <span class="stringliteral">&quot;:&quot;</span>);</div>
<div class="line"><span class="keywordtype">char</span> *str;</div>
<div class="line"><span class="keywordflow">while</span>((str = tokens-&gt;popfirst(tokens, NULL)) != NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;%s\n&quot;</span>, str);</div>
<div class="line">}</div>
<div class="line">tokens-&gt;free(tokens);</div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00629">629</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a2e9c44c24a06d24bccc1967972c63909" name="a2e9c44c24a06d24bccc1967972c63909"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e9c44c24a06d24bccc1967972c63909">&#9670;&#160;</a></span>qstrunique()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstrunique </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>seed</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Generate unique id. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">seed</td><td>additional seed string. this can be NULL</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced string</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The length of returned string is 32+1 bytes long including terminating NULL character. It's a good idea to call srand() once before calling this because it uses rand(). </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00660">660</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="ae5c7f3c367f90928d56b2db1cd60f646" name="ae5c7f3c367f90928d56b2db1cd60f646"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5c7f3c367f90928d56b2db1cd60f646">&#9670;&#160;</a></span>qstr_comma_number()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstr_comma_number </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>number</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert integer to comma string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">number</td><td>integer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced string which contains comma separated number if successful, otherwise returns NULL </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00691">691</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a6ddf2449ee1edb1139005fa88213567c" name="a6ddf2449ee1edb1139005fa88213567c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ddf2449ee1edb1139005fa88213567c">&#9670;&#160;</a></span>qstrtest()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qstrtest </td>
          <td>(</td>
          <td class="paramtype">int(*)(int)&#160;</td>
          <td class="paramname"><em>testfunc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Test for an alpha-numeric string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">testfunc</td><td>test function for individual character </td></tr>
    <tr><td class="paramname">str</td><td>a pointer of string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true for ok, otherwise returns false</dd></dl>
<div class="fragment"><div class="line"><span class="keywordflow">if</span>(<a class="code hl_function" href="qstring_8c.html#a6ddf2449ee1edb1139005fa88213567c">qstrtest</a>(isalnum, <span class="stringliteral">&quot;hello1234&quot;</span>) == <span class="keyword">true</span>) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;It is alpha-numeric string.&quot;</span>);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">if</span>(<a class="code hl_function" href="qstring_8c.html#a6ddf2449ee1edb1139005fa88213567c">qstrtest</a>(isdigit, <span class="stringliteral">&quot;0123456789&quot;</span>) == <span class="keyword">true</span>) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;It is alpha-numeric string.&quot;</span>);</div>
<div class="line">}</div>
<div class="ttc" id="aqstring_8c_html_a6ddf2449ee1edb1139005fa88213567c"><div class="ttname"><a href="qstring_8c.html#a6ddf2449ee1edb1139005fa88213567c">qstrtest</a></div><div class="ttdeci">bool qstrtest(int(*testfunc)(int), const char *str)</div><div class="ttdoc">Test for an alpha-numeric string.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00752">qstring.c:752</a></div></div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>Basically you can use below test functios without creating your own version. Make sure &lt;ctype.h&gt; header should be included before using any of these functions. isalnum - checks for an alphanumeric character. isalpha - checks for an alphabetic character. isascii - checks whether c is a 7-bit unsigned char value that fits into the ASCII character set. isblank - checks for a blank character; that is, a space or a tab. iscntrl - checks for a control character. isdigit - checks for a digit (0 through 9). isgraph - checks for any printable character except space. islower - checks for a lower-case character. isprint - checks for any printable character including space. ispunct - checks for any printable character which is not a space or an alphanumeric character. isspace - checks for white-space characters. isupper - checks for an uppercase letter. isxdigit - checks for a hexadecimal digits. Please refer "man isalnum" for more details about these functions. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00752">752</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="af8e066e1239a1670b9640bdf0e456b89" name="af8e066e1239a1670b9640bdf0e456b89"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8e066e1239a1670b9640bdf0e456b89">&#9670;&#160;</a></span>qstr_is_email()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qstr_is_email </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>email</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Test for an email-address formatted string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">email</td><td>email-address formatted string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false </dd></dl>

<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00767">767</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="a87849863c09feb068f316ffb63aaef03" name="a87849863c09feb068f316ffb63aaef03"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a87849863c09feb068f316ffb63aaef03">&#9670;&#160;</a></span>qstr_is_ip4addr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool qstr_is_ip4addr </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Test for an IPv4 address string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">url</td><td>IPv4 address string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false</dd></dl>
<div class="fragment"><div class="line"><span class="keywordflow">if</span>(<a class="code hl_function" href="qstring_8c.html#a87849863c09feb068f316ffb63aaef03">qstr_is_ip4addr</a>(<span class="stringliteral">&quot;1.2.3.4&quot;</span>) == <span class="keyword">true</span>) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;It is IPv4 address string.&quot;</span>);</div>
<div class="line">}</div>
<div class="ttc" id="aqstring_8c_html_a87849863c09feb068f316ffb63aaef03"><div class="ttname"><a href="qstring_8c.html#a87849863c09feb068f316ffb63aaef03">qstr_is_ip4addr</a></div><div class="ttdeci">bool qstr_is_ip4addr(const char *str)</div><div class="ttdoc">Test for an IPv4 address string.</div><div class="ttdef"><b>Definition</b> <a href="qstring_8c_source.html#l00825">qstring.c:825</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00825">825</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
<a id="ae5ce5ba220fb8ad35c4434d54912f00b" name="ae5ce5ba220fb8ad35c4434d54912f00b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5ce5ba220fb8ad35c4434d54912f00b">&#9670;&#160;</a></span>qstr_conv_encoding()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qstr_conv_encoding </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>fromcode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>tocode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>mag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert character encoding. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str</td><td>additional seed string. this can be NULL </td></tr>
    <tr><td class="paramname">fromcode</td><td>encoding type of str </td></tr>
    <tr><td class="paramname">tocode</td><td>encoding to convert </td></tr>
    <tr><td class="paramname">mag</td><td>magnification between fromcode and tocode</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of malloced converted string if successful, otherwise returns NULL</dd></dl>
<div class="fragment"><div class="line">qCharEncode(<span class="stringliteral">&quot;KOREAN_EUCKR_STRING&quot;</span>, <span class="stringliteral">&quot;EUC-KR&quot;</span>, <span class="stringliteral">&quot;UTF-8&quot;</span>, 1.5);</div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qstring_8c_source.html#l00866">866</a> of file <a class="el" href="qstring_8c_source.html">qstring.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_7b5d38f1875f1b693f62ca6a108a1129.html">utilities</a></li><li class="navelem"><a class="el" href="qstring_8c.html">qstring.c</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 </li>
  </ul>
</div>
</body>
</html>
